package com.ellricky.excute_president.ui.activity.home.task

import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.Fragment
import com.andr.common.ui.activity.BaseToolBarActivity
import com.andr.common.ui.mvp.BasePresenter
import com.ellricky.baselib.cache.LocalCacheUtil
import com.ellricky.excute_president.*
import kotlinx.android.synthetic.main.pd_activity_tab_vp.*
import java.util.*

class TaskManageListActivity : BaseToolBarActivity<Void, BasePresenter<Void>>() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        LocalCacheUtil.setIsReloadData(true)
    }

    override fun onPause() {
        super.onPause()
        LocalCacheUtil.setIsReloadData(false)
    }

    override fun getContentLayout(): Int = R.layout.pd_activity_tab_vp

    override fun initUIView() {
        super.initUIView()
        mTvTitle.text = getString(R.string.pd_task_manage)
        setRightBtn(0)

        val fragments = ArrayList<Fragment>()
        fragments.add(TaskFragment.newInstance(TASK_PAGE_KX))
        fragments.add(TaskFragment.newInstance(TASK_PAGE_ZX))
        fragments.add(TaskFragment.newInstance(TASK_PAGE_DT))
        fragments.add(TaskFragment.newInstance(TASK_PAGE_OTHER))

        val tList = ArrayList<String>()
        tList.add(getString(R.string.pd_task_kx))
        tList.add(getString(R.string.pd_task_zx))
        tList.add(getString(R.string.pd_task_dt))
        tList.add(getString(R.string.pd_task_other))

        tabVp.setUp(supportFragmentManager, fragments, tList)
    }

    override fun onClickBtnRight() {
        super.onClickBtnRight()
        val taskFrg = tabVp.curFrg as TaskFragment
        taskFrg.jumpTaskAddPage()
    }


    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
    }

}
